@model LanLordz.Models.JoinTeamModel
@{
    var controller = this.ViewContext.Controller as LanLordzBaseController;
    ViewBag.Title = "Join Team";
}
@section headers
{
  <script type="text/javascript" language="javascript">
      //<![CDATA[
      function JoinTeam(teamId) {
          $("#Team").val(teamId);
          $("#Team").parents("form:first").submit();
      }
      //]]>
  </script>
}
    <div class="EventsNavigator">@Html.ActionLink(controller.Config.SiteName + " Events", "Index") &gt; @Html.ActionLink(Model.Event.Title, "Details", new { id = Model.Event.EventID }) &gt; @Html.ActionLink(Model.Tournament.Title, "ViewTournament", new { id = Model.Tournament.TournamentID }) &gt; Join Team</div>
    <h2>@ViewBag.Title</h2>
    @if (!Model.AvailableTeams.Any()) {
    <p>There are no teams available to join.  You may, however, be able to @Html.ActionLink("create a team", "CreateTeam", new { id = Model.Tournament.TournamentID }).</p>
    }
    else {
    using (Html.BeginForm())
    {
     <text>
     @Html.AntiForgeryToken()
     @Html.ValidationSummary("There was an error joining the team:", new { @class = "ErrorText" })
     @Html.Hidden("Team")
     What percentage of gamers do you think you can beat in the tournament?<br /><br />
     <div>
      <input name="Rating" value="0" type="radio" />0% &nbsp
      <input name="Rating" value="10" type="radio" />10% &nbsp 
      <input name="Rating" value="20" type="radio" />20% &nbsp 
      <input name="Rating" value="30" type="radio" />30% &nbsp 
      <input name="Rating" value="40" type="radio" />40% &nbsp 
      <input name="Rating" value="50" type="radio" checked="checked" />50% &nbsp 
      <input name="Rating" value="60" type="radio" />60% &nbsp 
      <input name="Rating" value="70" type="radio" />70% &nbsp 
      <input name="Rating" value="80" type="radio" />80% &nbsp 
      <input name="Rating" value="90" type="radio" />90% &nbsp 
      <input name="Rating" value="100" type="radio" />100% &nbsp 
     </div><br /><br />
     <div class="EventTournamentJoinTeamTeamsList">
     @foreach (var team in Model.AvailableTeams)
     {
      <div class="EventTournamentJoinTeamTeam">
       <div class="EventTournamentJoinTeamTeamName">@team.TeamName <button onclick="JoinTeam(@team.TeamID);">Join</button></div>
       <div class="EventTournamentJoinTeamTeamMembers">
       @foreach (var User in team.UsersTeams.OrderByDescending(u => u.IsTeamCaptain))
       {
        <div class="EventTournamentJoinTeamTeamMemberName @(User.IsTeamCaptain ? "EventTournamentJoinTeamTeamMemberTeamCaptain" : "")">@string.Format(team.TeamTagFormat, User.User.Username)</div>
       }
       </div>
      </div>
     }
     </div>
     </text>
    }
    }
